package com.ias.agdis_r.module;

import com.ias.agdis_r.util.sdcard.WriteLog;

import java.util.HashMap;

/**
 * URL管理类
 * 
 * @author zhangsc
 *
 */
public class RestfulUri {

	private static HashMap<String, String> urlMap = new HashMap<String, String>();
	private static final String HTTP_HEAD = "http://"; // Http协议头
	public static int webPort = 80; // Http端口
	public static String webIPAddress = "";

	/** 登录URL */
	private static final String LOGIN_URL = "/agdis-terminalmanager/webservices/authRST/security/login?_type=json";
	/** 注销URL */
	private static final String LOGOUT_URL = "/agdis-terminalmanager/webservices/authRST/security/logout?_type=json";

	/** 航班查询URL */
	private static final String FLIGHT_QUERY_URL = "/agdis-terminalmanager/webservices/flightRST/flight/queryFlight?_type=json";
	/** 航班订阅 */
	private static final String FLIGHT_SUB_URL = "/agdis-terminalmanager/webservices/flightRST/flight/flightSub?_type=json";
	/** 查询已订阅航班 */
	private static final String FLIGHT_INIT_SUB_URL = "/agdis-terminalmanager/webservices/flightRST/flight/initflightSub?_type=json";
	/** 查询已订阅航班变更记录 */
	private static final String FLIGHT_CHANGE_HISTORY_URL = "/agdis-terminalmanager/webservices/flightRST/flight/getFlightChange?_type=json";

	/** 锁定资源 */
	private static final String FLIGHT_AUTO_TASK = "/agdis-terminalmanager/webservices/flightRST/flight/autoTask?_type=json";
	/** 资源锁定列表 */
	private static final String FLIGHT_INIT_AUTO_TASK = "/agdis-terminalmanager/webservices/flightRST/flight/initAutoTask?_type=json";

	/** 任务申请 */
	private static final String TERMINAL_APPLY_TASK_URL = "/agdis-terminalmanager/webservices/taskRST/task/Terminalapplytask?_type=json";

	/** 任务进程URL（TRPT） */
	private static final String SUBMITTASKPROCSS_URL = "/agdis-terminalmanager/webservices/taskRST/task/Submittaskprocss?_type=json";
	/** 根据TNB获取任务 */
	private static final String GET_TASK_BY_TNB_URL = "/agdis-terminalmanager/webservices/taskRST/task/Gettaskbytnb?_type=json";// 获取新任务
	/** 获取未完成任务TNB列表 */
	private static final String GET_UNFINISHED_TASK_TNB_URL = "/agdis-terminalmanager/webservices/taskRST/task/Getunfinishedtasklists?_type=json";// 获取未完成任务

	private static final String GET_UNFINISHED_EVENT_TASK_TNB_URL = "/agdis-terminalmanager/webservices/taskRST/task/GetUnfinishedEventTaskLists";
	/** 获取新任务TNB列表 */
	private static final String GET_NEW_TASK_TNB_URL = "/agdis-terminalmanager/webservices/taskRST/task/Getnewplantasklists?_type=json";// 获取新任务

	/** 单据摘要（BLRQ） */
	private static final String BILLGENERAL_URL = "/agdis-terminalmanager/webservices/billRST/bill/queryBillGeneral?_type=json";

	/** 单据详情（BLDT） */
	private static final String BILLDETAIL_URL = "/agdis-terminalmanager/webservices/billRST/bill/queryBillDetail?_type=json";

	/** 服务标注（TMRP） */
	private static final String TASKMARK_URL = "/agdis-terminalmanager/webservices/taskRST/task/Submittaskmark?_type=json";

	/** 短语模板（DYMB） */
	public static final String MESSAGE_TEMPLATE_INIT_URL = "/agdis-terminalmanager/webservices/messageRST/getMessageTemplets?_type=json";

	/** 发送短语 */
	public static final String MESSAGE_GWSM_URL = "/agdis-terminalmanager/webservices/messageRST/workingMsgUp?_type=json";

	/** 短语回执 */
	public static final String MESSAGE_GWRP_URL = "/agdis-terminalmanager/webservices/messageRST/workingMsgUp?_type=json";

	/** 单据打印（BLPT） */
	private static final String PRINTBILL_URL = "/agdis-terminalmanager/webservices/billRST/bill/printBill?_type=json";

	/** 车号上报（TRBD） */
	private static final String TASKVNB_URL = "/agdis-terminalmanager/webservices/taskRST/task/Submittaskvnb?_type=json";

	/** 转发任务（TTAS） */
	private static final String FORWARDTASK_URL = "/agdis-terminalmanager/webservices/taskRST/task/forwardTask?_type=json";

	/** 移交任务（TTAL） */
	private static final String HANDOVERTASK_URL = "/agdis-terminalmanager/webservices/taskRST/task/handOverTask?_type=json";

	/** 获取转发人员列表（QQRY） */
	private static final String GETGROUPMEMBER_URL = "/agdis-terminalmanager/webservices/taskRST/task/GetGroupmember?_type=json";

	/** 获取移交人员列表（GHOU） */
	private static final String GETHANDOVERUSER_URL = "/agdis-terminalmanager/webservices/taskRST/task/GetHandOverUser?_type=json";

	/** 人车绑定（UCBD） */
	private static final String BINDINGMANANDCAR_URL = "/agdis-terminalmanager/webservices/bindRST/binding/bindingManAndCar?_type=json";

	/** 任务监控（FLG10） */
	private static final String FINDFORWARDTASK_URL = "/agdis-terminalmanager/webservices/taskRST/task/findForwardTask?_type=json";

	/** 已转发任务（GTFL） */
	private static final String TASKTRANSFERRED_URL = "/agdis-terminalmanager/webservices/taskRST/task/findTaskTransferred?_type=json";

	/** 上传行李信息(ULBC) */
	private static final String UPLOADLUGGAGEBARCODE_URL = "/luggage-scan-master/luggage/upload?_type=json";

	/** 删除行李信息(DLBC) */
	private static final String DELETELUGGAGEBARCODE_URL = "/luggage-scan-master/luggage/delete?_type=json";

	/** 查询行李信息(QLBC) */
	private static final String QUERYLUGGAGEBARCODE_URL = "/luggage-scan-master/luggage/query?_type=json";

	/** 班组功能人员信息加载 */
	private static final String WORK_GROUP_MEMBER_LOAD = "/agdis-terminalmanager/webservices/workgroupRST/workgroup/load?_type=json";

	/** 班组功能添加人员 */
	private static final String WORK_GROUP_MEMBER_ADD = "/agdis-terminalmanager/webservices/workgroupRST/workgroup/add?_type=json";

	/** 班组功能移除人员 */
	private static final String WORK_GROUP_MEMBER_REMOVE = "/agdis-terminalmanager/webservices/workgroupRST/workgroup/delete?_type=json";

	/** 班组功能查询人员（查询所有人员） */
	private static final String WORK_GROUP_MEMBER_QUERY = "/agdis-terminalmanager/webservices/workgroupRST/workgroup/query?_type=json";

	/** 获取翻行李信息 */
	private static final String FIND_LUGGAGE_GET_INFO = "/agdis-turnLuggage/webservices/lugMessage/repeatSendMessage?_type=json";

	/** 上报翻行李信息 */
	private static final String FIND_LUGGAGE_REPORT = "/agdis-turnLuggage/webservices/lugMessage/messageUpload?_type=json";

	static {
		urlMap.put(MessageModel.RELI, LOGIN_URL);
		urlMap.put(MessageModel.RELO, LOGOUT_URL);
		urlMap.put(MessageModel.QFIQ, FLIGHT_QUERY_URL);
		urlMap.put(MessageModel.HBDY, FLIGHT_SUB_URL);
		urlMap.put(MessageModel.DYIN, FLIGHT_INIT_SUB_URL);
		urlMap.put(MessageModel.DYHI, FLIGHT_CHANGE_HISTORY_URL);
		urlMap.put(MessageModel.TTAQ, FLIGHT_AUTO_TASK);
		urlMap.put(MessageModel.INIT_TTAQ, FLIGHT_INIT_AUTO_TASK);
		urlMap.put(MessageModel.TTRQ, TERMINAL_APPLY_TASK_URL);
		urlMap.put(MessageModel.TRPT, SUBMITTASKPROCSS_URL);
		urlMap.put(MessageModel.BLRQ, BILLGENERAL_URL);
		urlMap.put(MessageModel.BLDT, BILLDETAIL_URL);
		urlMap.put(MessageModel.TASK, GET_TASK_BY_TNB_URL);
		urlMap.put(MessageModel.FLG4, GET_UNFINISHED_TASK_TNB_URL);
		urlMap.put(MessageModel.FLG41, GET_UNFINISHED_EVENT_TASK_TNB_URL);
		urlMap.put(MessageModel.FLG1, GET_NEW_TASK_TNB_URL);
		urlMap.put(MessageModel.TMRP, TASKMARK_URL);
		urlMap.put(MessageModel.BLPT, PRINTBILL_URL);
		urlMap.put(MessageModel.DYMB, MESSAGE_TEMPLATE_INIT_URL);
		urlMap.put(MessageModel.GWSM, MESSAGE_GWSM_URL);
		urlMap.put(MessageModel.GWRP, MESSAGE_GWRP_URL);
		urlMap.put(MessageModel.TRBD, TASKVNB_URL);

		urlMap.put(MessageModel.TTAS, FORWARDTASK_URL);
		urlMap.put(MessageModel.TTAL, HANDOVERTASK_URL);
		urlMap.put(MessageModel.QQRY, GETGROUPMEMBER_URL);
		urlMap.put(MessageModel.GHOU, GETHANDOVERUSER_URL);
		urlMap.put(MessageModel.UCBD, BINDINGMANANDCAR_URL);
		urlMap.put(MessageModel.FLG10, FINDFORWARDTASK_URL);
		urlMap.put(MessageModel.GTFL, TASKTRANSFERRED_URL);

		urlMap.put(MessageModel.ULBC, UPLOADLUGGAGEBARCODE_URL);
		urlMap.put(MessageModel.DLBC, DELETELUGGAGEBARCODE_URL);
		urlMap.put(MessageModel.QLBC, QUERYLUGGAGEBARCODE_URL);

		urlMap.put(MessageModel.WGQM, WORK_GROUP_MEMBER_QUERY);
		urlMap.put(MessageModel.WGAM, WORK_GROUP_MEMBER_ADD);
		urlMap.put(MessageModel.WGDM, WORK_GROUP_MEMBER_REMOVE);
		urlMap.put(MessageModel.WGLM, WORK_GROUP_MEMBER_LOAD);

		urlMap.put(MessageModel.FXLI, FIND_LUGGAGE_GET_INFO);
		urlMap.put(MessageModel.FXLR, FIND_LUGGAGE_REPORT);
	}

	public static String getUri(String serviceId) {
		String url = HTTP_HEAD + webIPAddress + ":" + webPort + urlMap.get(serviceId);
		WriteLog.getInstance().writeDebugLog("DEBUG---网络请求URL：" + url);
		return url;
	}
}
